﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace QueuesLib {
    [DataContract]
    public class Ticket {
        [DataMember(IsRequired = true, Order = 1)]
        public int Id { get; set; }

        [DataMember(IsRequired=true, Order=2)]
        public int Number { get; set; }

        [DataMember(IsRequired = true, Order = 3)]
        public DateTime CreationTime { get; set; }

        [DataMember(IsRequired = true, Order = 4)]
        public string Text { get; set; }

        [DataMember(IsRequired = true, Order = 5)]
        public string SubjectName { get; set; }

        public Ticket(int number, Subject subject) {
            Number = number;
            CreationTime = DateTime.Now;
            Text = subject.Mnemonic + (number % 1000).ToString("000");
            SubjectName = subject.Name;
        }

        public Ticket() {
            Text = SubjectName = "";
        }
        
    }
}
